FindControlUnderMouse
NEW WITH THE APPEARANCE MANAGER
Determines whether a mouse-down event has occurred in a control and, if so, in which.
pascal ControlHandle FindControlUnderMouse ( Point inWhere, WindowPtr inWindow, SInt16 *outPart);
inWhere
- On input, a point, specified in coordinates local to the window, where the mouse-down event occurred. Before calling
FindControlUnderMouse
, use the QuickDrawGlobalToLocal
function to convert the point stored in thewhere field of the event structure (which describes the location of the mouse-down event) to coordinates local to the window.
inWindow
- On input, a pointer to the window in which the mouse-down event occurred.
outPart
- On output, a pointer to the part code of the control part which was selected; see "Control Part Code Constants".
- function result
- Returns a handle to the control that was selected. If the mouse-down event did not occur over a control part,
nil
is returned.DISCUSSION
You should call theFindControlUnderMouse
function instead ofFindControl
to determine whether a mouse-down event occurred in a control, particularly if an embedding hierarchy is present.FindControlUnderMouse
will return a handle to the control even if no part was hit and can determine whether a mouse-down event has occurred even if the control is deactivated, whileFindControl
does not.When a mouse-down event occurs, your application should call
FindControlUnderMouse
after using the Window Manager functionFindWindow
to ascertain that a mouse-down event has occurred in the content region of a window containing controls.SEE ALSO
"Embedding Controls"."Appearance Manager Gestalt Selector Constants".